package com.lgc.demo.recursion;

/**
 * 每两个空瓶子能换一瓶饮料，计算共能喝到多少瓶饮料
 */
public class ExchangeDrink {

    public int getDrinks(int bottle) {
        if (bottle<=1) {
            return 0;
        } else {
            if(bottle%2==1) {
                return bottle/2 + getDrinks(bottle/2+1);
            }else
            {
                return bottle/2 + getDrinks(bottle/2);
            }
        }
    }

    public static void main(String[] args) {
        ExchangeDrink exchangeDrink=new ExchangeDrink();
        int drinks =exchangeDrink.getDrinks(11);

        int a=0;
    }
}
